package net.huashitong.supervision.task.controller;

import com.sirdc.modules.core.web.JsonBaseController;
import com.sirdc.modules.core.web.model.JqGrid;
import net.huashitong.supervision.task.entity.TaskMain;
import net.huashitong.supervision.task.filter.TaskMainFilter;
import net.huashitong.supervision.task.service.TaskMainService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * User: ling
 * Date: 2019/11/11
 * Time: 16:14
 * To change this template use File | Settings | File Templates.
 * Description:管理员菜单
 */
@Controller
@RequestMapping(value = "/admin")
public class AdminController extends JsonBaseController {
    @Autowired
        private TaskMainService taskMainService;
    @Override
    protected String getView(String s) {
        return "/modules/task/admin/"+s;
    }

    /**
     * 全部任务
     * @return
     */
    @RequestMapping(value = "/allTask")
    public String allTask(){
        return getView("/allTask");
    }

    @ResponseBody
    @RequestMapping(value = "allTask",method = RequestMethod.POST)
    public JqGrid allTask(TaskMainFilter filter){
        List<TaskMain> taskMainList = taskMainService.queryFilter(filter);
        return coverJqGrid(filter,taskMainList );
    }

}
